<?php
set_time_limit(0);
$userDui=0;
 
    include '../c/config.php';
  
    $nianji=5;

     
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

    $sql="SELECT *  FROM `d5` WHERE id='29573'  LIMIT 0,1";
    $query=$mysqli->query($sql);
    if($query->num_rows>0){
       $getData=$query->fetch_assoc();
     }else{
      exit;
     }
    
    $getAn=array();
    if (3 == $nianji) {
       $getAn=json_decode(file_get_contents('../3.txt'), true);
    }
    if (4 == $nianji) {
       $getAn=json_decode(file_get_contents('../4.txt'), true);
    }
    if (5 == $nianji) {
       $getAn=json_decode(file_get_contents('../5.txt'), true);
    }    
    
     $userYi=json_decode($getData['yi'],true);
     foreach ($userYi as $k => $v ){
       if ($v == $getAn['yi'][$k]) {
         $userDui++;
       }
     }
 
 
     $userEr=json_decode($getData['er'], true);
     foreach ($userEr as $k => $v ){
       if ($v == $getAn['er'][$k]) {
         $userDui++;
       }
     }
   
 
     $userSan=json_decode($getData['san'], true);
     foreach ($userSan as $k => $v ){
       if ($v == $getAn['san'][$k]) {
         $userDui++;
       }
     }
  
 
    
echo "userDui: ",$userDui; 

  
    $mysqli->close();

 

?>